package ClubRecruitment;

public class BookSystem {
    public static void main(String[] args) {
        String[] bookIds = {"B001","B002","B003","B004","B005"};
        String[] bookNames = {"Java编程基础","数据结构与算法","Python入门","数据库原理","计算机网络络"};
        boolean[] isBorrowed = {true,false,true,false,false} ; //true 已借出 false为借出

        System.out.println("当前可借阅的图书： ");
        int availableCount = 0;
        for (int i = 0; i < bookIds.length; i++){
            if (!isBorrowed[i]){
                System.out.println(bookIds[i] + ": " + bookNames[i]);
                availableCount++;
            }
        }
        System.out.println("可借阅图书总量: " + availableCount);

        String returnBookId = "B001";
        for (int i = 0; i < bookIds.length; i++ ){
            if (bookIds[i].equals(returnBookId)){
                isBorrowed[i] = false;
                System.out.println("\n"+ returnBookId + "已归还");
                break;
            }
        }
        availableCount = 0;
        for (boolean borrowed : isBorrowed){
            if (!borrowed)  availableCount++;

        }
        System.out.println("归还后可借阅图书总量： " + availableCount);
    }
}
